$(function () {
    if (GetQueryString("name")=="2"){
    $.ajax({
      url:"front/hostbank/detail/2.do",
      type:"GET",
      dataType:"JSON",
      success:function (json) {
          if ("json.code==0"){
              $(".news-mid2").children().remove();
          var new1 = $("<div class='deta-title'>"+json.data.name+"</div><div class='deta-titletime'>发布时间：<span style='margin-right: 10px;'>"+json.data.releaseTimeStr+"</span>阅读次数：<span>"+json.data.readNum+"</span>次</div><div class='deta-nr'>"+json.data.content+"</div>").appendTo(".news-mid2");
          }else {
           alert(json.message);
          }
      }
    })
        $(".hxgn-detTab.2").addClass("hxgn-active").siblings().removeClass("hxgn-active");
        $("."+$(".hxgn-detTab.2").attr("dataDiv")).addClass("news-midshow").siblings().removeClass("news-midshow");
        $(".wz").text($(".hxgn-detTab.2").attr("wz"));
    }else {
        $.ajax({
            url:"front/hostbank/detail/1.do",
            type:"GET",
            dataType:"JSON",
            success:function (json) {
                if ("json.code==0"){
                    $(".news-mid1").children().remove();
                    var new1 = $("<div class='deta-title'>"+json.data.name+"</div><div class='deta-titletime'>发布时间：<span style='margin-right: 10px;'>"+json.data.releaseTimeStr+"</span>阅读次数：<span>"+json.data.readNum+"</span>次</div><div class='deta-nr'>"+json.data.content+"</div>").appendTo(".news-mid1");
                }else {
                    alert(json.message);
                }
            }
        })
    }

    $(".hxgn-detTab").click(function(){
        $(this).addClass("hxgn-active").siblings().removeClass("hxgn-active");
        $("."+$(this).attr("dataDiv")).addClass("news-midshow").siblings().removeClass("news-midshow");
        $(".wz").text($(this).attr("wz"));
        if($(this).attr("banktype")=="2"){
            $.ajax({
                url:"front/hostbank/detail/2.do",
                type:"GET",
                dataType:"JSON",
                success:function (json) {
                    if ("json.code==0"){
                        $(".news-mid2").children().remove()
                        var new1 = $("<div class='deta-title'>"+json.data.name+"</div><div class='deta-titletime'>发布时间：<span style='margin-right: 10px;'>"+json.data.releaseTimeStr+"</span>阅读次数：<span>"+json.data.readNum+"</span>次</div><div class='deta-nr'>"+json.data.content+"</div>").appendTo(".news-mid2");
                    }else {
                        alert(json.message);
                    }
                }
            })
        }else {
            $.ajax({
                url:"front/hostbank/detail/1.do",
                type:"GET",
                dataType:"JSON",
                success:function (json) {
                    if ("json.code==0"){
                        $(".news-mid1").children().remove();
                        var new1 = $("<div class='deta-title'>"+json.data.name+"</div><div class='deta-titletime'>发布时间：<span style='margin-right: 10px;'>"+json.data.releaseTimeStr+"</span>阅读次数：<span>"+json.data.readNum+"</span>次</div><div class='deta-nr'>"+json.data.content+"</div>").appendTo(".news-mid1");
                    }else {
                        alert(json.message);
                    }
                }
            })
        }
    })

})

function GetQueryString(name)
{
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  unescape(r[2]); return null;
}